var CryptoJS = require('aes.js');  
var key = CryptoJS.enc.Utf8.parse("1234123412ABCDEF");//十六位十六进制数秘钥
var iv = CryptoJS.enc.Utf8.parse('ABCDEF1234123412');//十六位十六进制数秘钥偏移量
 
//解密
function Decrypt(word){
  var decrypt = CryptoJS.AES.decrypt(word, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 });
  var decryptedStr = decrypt.toString(CryptoJS.enc.Utf8);
  return decryptedStr.toString();
}
 
//加密
function Encrypt(word) {
  var srcs = CryptoJS.enc.Utf8.parse(word);
  var encrypted = CryptoJS.AES.encrypt(srcs, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 });
  return encrypted.ciphertext.toString(CryptoJS.enc.Base64);
}
 
 
module.exports.Decrypt = Decrypt;
module.exports.Encrypt = Encrypt;